<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>{:lang('用户登录')}-{:lang($cyConfig.sitename)}</title>

		<meta name="description" content="User login page" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="/static/admin/css/bootstrap.min.css" />
		<link rel="stylesheet" href="/static/admin/font-awesome/4.5.0/css/font-awesome.min.css" />

		<!-- text fonts -->
		<link rel="stylesheet" href="/static/admin/css/fonts.googleapis.com.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="/static/admin/css/ace.min.css" />

		<!--[if lte IE 9]>
			<link rel="stylesheet" href="/static/admin/css/ace-part2.min.css" />
		<![endif]-->
		<link rel="stylesheet" href="/static/admin/css/ace-rtl.min.css" />

		<!--[if lte IE 9]>
		  <link rel="stylesheet" href="/static/admin/css/ace-ie.min.css" />
		<![endif]-->

		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

		<!--[if lte IE 8]>
		<script src="/static/admin/js/html5shiv.min.js"></script>
		<script src="/static/admin/js/respond.min.js"></script>
		<![endif]-->
	</head>

	<body class="login-layout default-login">
		<div class="main-container">
			<div class="main-content">
				<div class="row">
					<div class="col-sm-10 col-sm-offset-1">
						<div class="login-container">
							<div class="center">
								<h1>
									<span class="red">{:lang('用户登录')}</span>
								</h1>
								<h4 class="blue" id="id-company-text">&copy; CYAdmin</h4>
							</div>

							<div class="space-6"></div>

							<div class="position-relative">
								<div id="login-box" class="login-box visible widget-box no-border">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header blue lighter bigger">
												<i class="ace-icon fa fa-coffee green"></i>
												{:lang('请输入登录信息')}
											</h4>

											<div class="space-6"></div>

											<form id="form" action="{:url('admin/login/login')}" method="post">
												<fieldset>
													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="text" name="username" id="username" class="form-control" placeholder="{:lang('用户名')}">
															<i class="ace-icon fa fa-user"></i>
														</span>
													</label>

													<label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" name="password" id="password" class="form-control" placeholder="{:lang('用户密码')}">
															<i class="ace-icon fa fa-lock"></i>
														</span>
													</label>

                                                    <label class="block clearfix">
														<div class="row">
														<div class="col-xs-7">
														<span class="input-icon input-icon-right">
															<input class="col-lg-12" type="text" name="captcha" id="captcha" placeholder="{:lang('验证码')}">
															<i style="cursor:pointer;" id="refreshcaptcha" class="ace-icon fa fa-refresh green pointer" title="{:lang('看不清楚？点击刷新')}"></i>
														</span>
														</div>
														<div class="col-xs-5">
														<img style="cursor:pointer;" id="captchaimg" src="{:captcha_src()}" width="100" height="32" title="{:lang('看不清楚？点击刷新')}">
														</div>
														</div>
													</label>

													<div class="space"></div>

													<div class="clearfix">
														<label class="inline">
															<input type="checkbox" name="remember" id="remember" class="ace" />
															<span class="lbl"> {:lang('记住我')}</span>
														</label>

														<button type="button" class="width-35 pull-right btn btn-sm btn-primary">
															<i class="ace-icon fa fa-key"></i>
															<span class="bigger-110">{:lang('登录')}</span>
														</button>
													</div>

													<div class="space-4"></div>
												</fieldset>
											</form>


										</div><!-- /.widget-main -->
									</div><!-- /.widget-body -->
								</div><!-- /.login-box -->
							</div><!-- /.position-relative -->
							<div class="navbar-fixed-top align-right">
								<br />
								&nbsp;
								<a id="btn-login-default" href="#">Default</a>
								&nbsp;
                                <span class="blue">/</span>
								&nbsp;
								<a id="btn-login-dark" href="#">Dark</a>
								&nbsp;
								<span class="blue">/</span>
								&nbsp;
								<a id="btn-login-blur" href="#">Blur</a>
								&nbsp;
								<span class="blue">/</span>
								&nbsp;
								<a id="btn-login-light" href="#">Light</a>
								&nbsp; &nbsp; &nbsp;
							</div>
						</div>
					</div><!-- /.col -->
				</div><!-- /.row -->
			</div><!-- /.main-content -->
		</div><!-- /.main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script src="/static/admin/js/jquery-2.1.4.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
        <script src="/static/admin/js/jquery-1.11.3.min.js"></script>
        <![endif]-->
        <script src="/static/layer/layer.js"></script>
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='/static/admin/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>

		<script type="text/javascript">
			$(function($) {
			 $('#btn-login-dark').on('click', function(e) {
				$('body').attr('class', 'login-layout');
				$('#id-company-text').attr('class', 'blue');

				e.preventDefault();
			 });
			 $('#btn-login-light').on('click', function(e) {
				$('body').attr('class', 'login-layout light-login');
				$('#id-company-text').attr('class', 'blue');

				e.preventDefault();
			 });
			 $('#btn-login-blur').on('click', function(e) {
				$('body').attr('class', 'login-layout blur-login');
				$('#id-company-text').attr('class', 'light-blue');

				e.preventDefault();
			 });
			 $('#btn-login-default').on('click', function(e) {
				$('body').attr('class', 'login-layout default-login');
				$('#id-company-text').attr('class', 'light-blue');
				e.preventDefault();
			 });
			 $("#refreshcaptcha,#captchaimg").on('click',function(e){
				$("#captchaimg").attr('src',$("#captchaimg").attr('src')+'?t='+new Date().getTime());
			 })
			 $('#form').on('keydown', function(e) {
		    if (e.key === 'Enter' || e.keyCode === 13) {
		      e.preventDefault();
		      $("button").click();
		    }
		  });
			 $("button").on('click',function(e){
				let formData = $("#form").serializeArray();
            $.post('{:url('admin/user/login')}',formData,function(res){
                if(res.code != 1){
										$("#captchaimg").attr('src',$("#captchaimg").attr('src')+'?t='+new Date().getTime());
                    layer.alert(res.msg, {title: '{:lang('系统信息')}',btn:'{:lang('确定')}'},);
                }else{
                    location.href = "{:url('admin/index/index')}";
                }
            });
			 })
			});
		</script>
	</body>
</html>
